home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
M-More Monthly Disks
/
(c)md.d64
/
dungeon.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
8KB
|
267 lines
5 REM ** DUNGEON OF DEATH **
7 REM ** BY BRAD LEYPOLD **
10 POKE52,56:POKE56,56:CLR
20 POKE53280,0:POKE53281,0
30 PRINT"[147][156]DUNGEON OF DEATH"
35 PRINT"BY BRAD LEYPOLD"
40 PRINT"PLEASE WAIT"
45 REM ** DEFINE CHARACTERS, SPRITES **
50 POKE56334,PEEK(56334)AND254:POKE1,PEEK(1)AND251
60 FORI=14336TO14336+256*8:POKEI,PEEK(I+38912):NEXT
70 POKE1,PEEK(1)OR4:POKE56334,PEEK(56334)OR1
80 FORI=14336+64*8TO14336+75*8:READA:POKEI,A:NEXT
90 FORI=832TO1023:READA:IFA=-1THEN93
91 POKEI,A
93 NEXTI
95 REM ** DEFINE VARIABLES **
99 GOSUB2800
100 PRINT"[147]";:FORI=2TO16:POKE53280,I:POKE53281,I:FORI2=1TO25:NEXT:NEXT
102 PRINT"[147]BEWARE !":FORI=1TO200:NEXT
103 S=1024:C=54272:V=53248:CM=55296
105 T(0)=0:T(1)=3000:T(2)=3:FF=0
110 A=0:DEFFNPS(A)=S+X+40*Y
120 ZZ=80:FORI=1TO4:A=INT(RND(1)*38+1):DI(I)=A+S+ZZ:ZZ=ZZ+80:NEXT
128 FU(1)=120:FU(2)=200:FU(3)=280
130 FORI=1TO3:WR(I)=INT(RND(1)*38+1):DEFFNW(I)=S+FU(I)+WR(I)
131 NEXT
140 FORI=1TO4:DEFFNGB(I)=S+X(I)+40*Y(I):NEXT
145 A=1
150 DEFFNSX(A)=X*8+24:DEFFNSY(A)=Y*8+50
160 X=3:Y=2:FORI=1TO4:X(I)=INT(RND(1)*38)+1:Y(I)=INT(RND(1)*8)+10:NEXT
170 D1=1:D2=-1:L1=14:L2=15
175 PP=64
190 V0=213:V1=213:V2=202
200 H0=170:H1=84:H2=254
210 PRINT"[147]";
211 FORI=0TO24:POKEC+I,0:NEXT
215 POKEC,15:POKEC+6,240:POKEC+24,15
217 GOSUB2400
220 POKEV+24,(PEEK(V+24)AND240)+14
230 POKEV+22,PEEK(V+22)OR16
240 POKEV+34,2:POKEV+35,5
250 GOSUB1200:GOSUB1300:GOSUB1500
295 REM ** WALLS **
300 GOSUB1200
310 GOSUB1700
315 PE=PEEK(FNPS(0))
317 POKEC+4,32
320 IFPE=66ORPE=67GOTO1800
335 IFPE=68THENGOSUB1900:GOSUB2420
340 POKEFNPS(0),PP:POKEFNPS(0)+C,3
350 GOSUB2000
360 FF=FF+1:IFFF=20THENT(1)=T(1)-100:FF=0
365 IFFNPS(0)=S+420THENGOSUB2050:GOTO400
370 GOTO300
400 REM ** GOBLINS **
405 ES=0
410 GOSUB1200:GOSUB1700
420 A=INT(RND(1)*KK)+1:POKEC+4,32
425 IFA>4THENGOTO520
430 POKEFNGB(A),32:POKEFNGB(A)+C,0
435 IFX<X(A)THENX(A)=X(A)-1
440 IFX>X(A)THENX(A)=X(A)+1
450 IFY<Y(A)THENY(A)=Y(A)-1
455 POKEC+11,33
460 IFY>Y(A)THENY(A)=Y(A)+1
465 POKEC+11,32
470 PE=PEEK(FNGB(A))
480 IFPE=66ORPE=67ORPE=73ORPE=69ORPE=70THENGOSUB2100
500 POKEFNGB(A),73:POKEFNGB(A)+C,12
520 PE=PEEK(FNPS(0))
530 IFPE=66ORPE=67ORPE=73GOTO1800
560 IFPE=69ORPE=70THENT(0)=T(0)+250:ES=ES+1:GOSUB2420
570 POKEFNPS(0),PP:POKEFNPS(0)+C,3
580 IFES=2THENPOKES+740,32:POKECM+740,0
585 FF=FF+1:IFFF=20THENT(1)=T(1)-100:FF=0
590 IFFNPS(0)=S+780GOTO600
595 GOTO410
600 REM ** SPIRITS **
601 SF=0
602 ES=0
603 GOSUB2050
604 FORI=S+720TOS+759:POKEI,66:POKEI+C,14:NEXT
605 POKEV+31,0
610 GOSUB1200:GOSUB1700
620 V1=V1+D2:V2=V2+D1
630 L1=L1+1:L2=L2+1:IFL1=16THENL1=14
635 POKEC+4,32
640 IFL2=16THENL2=14
650 POKE2041,L1:POKE2042,L2
660 IFV1=213ORV2=213THEND2=-D2:D1=-D1
670 POKEV+3,V1:POKEV+5,V2
680 IFFNSY(1)<PEEK(V+1)THENA=-1
690 IFFNSY(1)>PEEK(V+1)THENA=1
700 IFFNSX(1)<(PEEK(V)+(-SF*256))THENA1=-1
710 IFFNSX(1)>(PEEK(V)+(-SF*256))THENA1=1
720 V0=V0+A:H0=H0+A1:IFV0=214THENV0=213
725 SF=(H0>255)
730 POKEV+1,V0
740 POKEV,H0+(SF*256):POKEV+16,SF*(-1)
742 PE=PEEK(FNPS(0))
744 IFPE=66ORPE=67GOTO1800
746 IFPE=71ORPE=72THENT(0)=T(0)+500:ES=ES+1:GOSUB2420
748 IFES=2THENGOTO2200
750 POKEFNPS(0),PP:POKEFNPS(0)+C,3
760 SC=PEEK(V+31)
770 IF(SCAND1)GOTO1800
780 IF(SCAND2)GOTO1800
790 IF(SCAND4)GOTO1800
795 FF=FF+1:IFFF=20THENT(1)=T(1)-100:FF=0
800 GOTO605
1195 REM ** SCORING ROUTINE **
1200 PRINT"[159]SCORE:";T(0);"[157] BONUS: ";T(1);"[158][157] MEN: ";T(2)
1210 RETURN
1295 REM ** DRAW SCREEN **
1300 FORI=S+40TOS+79:POKEI,66:POKEI+C,14:NEXT
1310 FORI=S+920TOS+959:POKEI,66:POKEI+C,14:NEXT
1320 FORI=S+40TOS+920STEP40:POKEI,66:POKEI+C,14:NEXT
1330 FORI=S+79TOS+959STEP40:POKEI,66:POKEI+C,14:NEXT
1340 A=S+120:FORI=1TO3:FORI2=1TO38:POKEA+I2,67:POKEA+I2+C,11:NEXT
1345 A=A+80:NEXT
1350 FORI=S+360TOS+399:POKEI,66:POKEI+C,14:NEXT:POKES+380,32:POKECM+380,0
1360 FORI=S+720TOS+759:POKEI,66:POKEI+C,14:NEXT:POKES+740,32:POKECM+740,0
1370 POKES+419,66:POKECM+419,14:POKES+421,66:POKECM+421,14
1380 POKES+779,66:POKECM+779,14:POKES+781,66:POKECM+781,14
1385 POKES+740,66:POKECM+740,14
1390 POKES+485,67:POKECM+485,11:POKES+605,67:POKECM+605,11
1400 POKES+570,67:POKECM+570,11
1410 POKES+500,67:POKECM+500,11:POKES+660,67:POKECM+660,11
1420 POKES+578,67:POKECM+578,11:POKES+582,67:POKECM+582,11
1430 POKES+589,67:POKECM+589,11
1440 POKES+514,67:POKECM+514,11:POKES+634,67:POKECM+634,11
1450 RETURN
1495 REM ** PLACE OBJECTS, PEOPLE **
1500 POKEFNPS(0),64:POKEFNPS(0)+C,3
1510 FORI=1TO4:POKEDI(I),68:POKEDI(I)+C,1:NEXT
1520 FORI=1TO4:POKEFNGB(I),73:POKEFNGB(I)+C,12:NEXT
1530 FORI=1TO3:POKEFNW(I),32:POKEFNW(I)+C,0:NEXT
1540 POKES+522,69:POKECM+522,7:POKES+557,70:POKECM+557,7
1550 POKES+842,71:POKECM+842,2:POKES+877,72:POKECM+877,2
1560 POKE2040,13:POKE2041,14:POKE2042,15
1570 POKEV+39,8:POKEV+40,1:POKEV+41,1
1580 POKEV,H0:POKEV+2,H1:POKEV+4,H2
1590 POKEV+1,V0:POKEV+3,V1:POKEV+5,V2
1600 POKEV+21,7
1630 RETURN
1695 REM ** JOYSTICK **
1700 JR=PEEK(56320)
1710 HD=SGN(JRAND4)-SGN(JRAND8)
1720 VD=SGN(JRAND1)-SGN(JRAND2)
1725 IFHD<>0ORVD<>0THENPP=PP+1:POKEFNPS(0),32:POKEFNPS(0)+C,0:IFPP=66THENPP=64
1727 IFHD<>0ORVD<>0THENGOSUB2450
1730 X=X+HD:Y=Y+VD
1740 RETURN
1800 POKEC,8:POKEC+1,98:POKEC+6,247
1803 POKEC+4,129:POKEFNPS(0),PP
1804 FORI=1TO75:POKEFNPS(0)+C,I:NEXT:POKEC+4,128
1805 T(2)=T(2)-1:IFT(2)=0THEN2900
1810 POKEV+21,0:FF=0:T(1)=3000:GOTO110
1900 FORI=1TO4:IFFNPS(0)=DI(I)THENPOKEDI(I),32:POKEDI(I)+C,0:T(0)=T(0)+100:I=4
1910 NEXT:RETURN
2000 FORI=1TO3:WR(I)=WR(I)+1:IFWR(I)=41THENWR(I)=2:GOSUB2025
2010 POKEFNW(I),32:POKEFNW(I)+C,0:POKEFNW(I)-2,67:POKEFNW(I)+C-2,11
2020 IFFNW(I)-2=FNPS(0)THEN1800
2021 NEXT:RETURN
2025 POKES+FU(I)+39,67:POKECM+FU(I)+39,11
2030 POKES+FU(I)+40,66:POKECM+FU(I)+40,14:RETURN
2050 POKEFNPS(0)-40,66:POKEFNPS(0)+C-40,14
2055 POKEFNPS(0)-1,32:POKEFNPS(0)+C-1,0:POKEFNPS(0)+1,32:POKEFNPS(0)+C+1,0
2060 RETURN
2100 POKEFNGB(A)-1,32:POKEFNGB(A)+C-1,0
2105 POKEC+11,33:FORI2=67TO37STEP-1:POKEC+8,I2:FORI3=1TO5:NEXT:NEXT
2106 POKEC+11,32:GOSUB2400
2110 X(A)=INT(RND(1)*38)+1:Y(A)=INT(RND(1)*8)+10
2120 POKEFNGB(A),73:POKEFNGB(A)+C,13
2130 RETURN
2200 REM ** RING FOUND **
2201 PRINT"[147]":POKEV+21,0
2205 T(0)=T(0)+T(1)
2210 PRINT"[156][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209]"
2220 PRINT"RING OF POWER FOUND"
2230 PRINT"[156]DUNGEON OF DEATH DESTROYED"
2235 PRINT"[159]CONGRADULATIONS"
2240 PRINT"[158]FINAL SCORE: ";T(0)
2250 IFT(0)=>4500THENA$="WARRIOR KING"
2260 IFT(0)<=4499THENA$="HONORABLE KNIGHT"
2270 IFT(0)<=3750THENA$="COMMON FIGHTER"
2280 IFT(0)<=2500THENA$="LUCKY SIGHTSEER"
2290 PRINT"[159]THIS GIVES YOU THE RANK OF A "
2295 PRINT"";A$
2300 PRINT"[156][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][145][145][145][145][145][156]"
2303 POKEC,49:POKEC+1,16:POKEC+5,32:POKEC+6,250
2304 POKEC+7,15:POKEC+8,32:POKEC+12,32:POKEC+13,67
2305 POKEC+2,64:POKEC+3,10
2307 POKEC+11,33:POKEC+4,65:FORI=1TO400:NEXT:POKEC+4,64:POKEC+11,32
2310 GOTO2910
2400 POKEC+7,15:POKEC+8,67:POKEC+13,240:RETURN
2420 POKEC+7,30:POKEC+8,137:POKEC+11,33:FORI=1TO50:NEXT:POKEC+11,32
2425 GOSUB2400:RETURN
2450 POKEC+4,33:POKEC+1,16:RETURN
2800 REM ** INSTRUCTIONS **
2805 PRINT"[147]";
2810 PRINT"YOU ARE ARNIE THE ADVENTURER. YOUR"
2815 PRINT"QUEST IS TO FIND THE RING OF POWER. YOU"
2820 PRINT"SEEM TO HAVE FORGOT YOUR WEAPONS SO ALL"
2825 PRINT"HAVE IS YOUR WITS AND REFLEXES."
2830 PRINT"YOUR FIRST CHALLENGE IS TO PASS THE"
2835 PRINT"MOVING WALLS. YOU CAN PICK UP THE"
2840 PRINT"DIAMONDS ALONG THE WAY, THEY'RE WORTH"
2845 PRINT"100 POINTS EACH"
2850 PRINT"NEXT YOU MUST AVOID THE GOBLINS. YOU"
2855 PRINT"ALSO MUST PICK UP THE TWO PIECES OF THE"
2860 PRINT"KEY. THEY ARE WORTH 250 POINTS EACH."
2865 PRINT"AFTER YOU GET THE TWO PIECES OF THE"
2870 PRINT"KEY YOU MUST GET THE TWO PIECES OF THE"
2875 PRINT"RING. IF THE EVIL SPIRIT OR ONE OF THE"
2880 PRINT"GHOULS TOUCHES YOU, YOU WILL DIE. EACH"
2885 PRINT"OF THE PIECES IS WORTH 500 POINTS"
2890 PRINT"YOUR BONUS TIME COUNTS DOWN FROM 3000"
2891 PRINT"POINTS. USE A JOYSTICK IN PORT#2"
2893 PRINT"SKILL LEVEL? (1-HARD...4-EASY)"
2894 GETA$:IFA$=""THEN2894
2895 KK=VAL(A$):IFKK<1ORKK>4THEN2894
2896 KK=KK+3:RETURN
2900 FORI=1TO200:NEXT
2905 PRINT"[159]GAME OVER"
2907 POKEC+4,33:FORI=67TO1STEP-1:POKEC+1,I:FORI2=1TO3:NEXT:NEXT:POKEC+4,32
2910 PRINT"PLAY AGAIN (Y/N)?"
2930 GETA$:IFA$=""THENGOTO2930
2940 IFA$="Y"THENPRINT"[147]":POKEV+21,0:CLR:GOSUB2893:PRINT"[147]";:GOTO100
2950 IFA$="N"THENGOTO2960
2955 GOTO2930
2960 POKEV+24,21:POKEV+22,PEEK(V+22)AND239:POKEV+21,0:PRINT"[147][155]":END
2995 REM ** CHAR DATA **
3000 DATA 60,60,216,126,27,60,38,96
3010 DATA 60,60,27,126,216,60,100,6
3020 DATA 170,143,82,143,82,143,82,170
3030 DATA 0,60,170,130,255,65,85,60
3040 DATA 0,24,60,102,195,102,60,24
3050 DATA 48,96,192,112,24,120,24,248
3060 DATA 28,6,3,14,24,30,24,31
3070 DATA 120,56,24,96,128,128,96,24
3080 DATA 30,28,24,6,1,1,6,24
3090 DATA 195,195,0,40,0,65,20,0
3095 DATA 0,0,0,0,0,0,0,0
3100 REM ** SPRITE DATA **
3110 DATA 0,0,0,0,4,0,32,6,0,96
3120 DATA 7,0,224,3,129,192,0,0,0
3130 DATA 0,24,0,0,24,0,0,60,0
3140 DATA 0,90,0,0,0,0,16,0,8
3150 DATA 24,0,24,12,0,48,6,0,96
3160 DATA 3,129,192,0,255,0,0,60,0
3170 DATA 0,0,0,0,0,0,0,0,0,-1
3180 DATA 0,60,0,0,90,0,0,102,0
3190 DATA 0,66,0,0,60,0,7,24,0
3200 DATA 13,152,8,24,255,24,48,25,176
3210 DATA 0,24,224,0,24,0,0,255,0
3220 DATA 0,195,0,0,195,0,0,195,0
3230 DATA 0,195,0,0,195,128,0,195,192
3240 DATA 0,192,0,1,192,0,3,192,0,-1
3250 DATA 0,60,0,0,90,0,0,102,0
3260 DATA 0,66,0,0,60,0,0,24,224
3270 DATA 48,25,176,24,255,24,13,152,12
3280 DATA 7,24,0,0,24,0,0,255,0
3290 DATA 0,195,0,0,195,0,0,195,0
3300 DATA 0,195,0,1,195,0,3,195,0
3310 DATA 0,3,0,0,3,128,0,3,192,0,0,-1